/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PokerFrame.java
 *
 * Created on 2011-03-03, 11:39:10
 */

package poker.gui;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

/**
 *
 * @author AH52560
 */
public class PokerFrame extends javax.swing.JFrame implements MouseListener, MouseMotionListener {
	
	FingerContainer fingerContainer = new FingerContainer();
	private boolean isFingerDraggingModeActive = false;
	private int indexOfFingerUnderMouse = -1;
	private int mouse_x, mouse_y;
	public static final int TOUCH_EVENT_DOWN = 0;
	public static final int TOUCH_EVENT_MOVE = 1;
	public static final int TOUCH_EVENT_UP = 2;

	private PokerFrame pf;
	
	private javax.swing.JPanel player1InternalPanel;
	private javax.swing.JPanel player2InternalPanel;
    private javax.swing.JPanel player3InternalPanel;
    private javax.swing.JPanel player4InternalPanel;
    
    public static boolean cardZoneP1Enabled = false;
    public static boolean cardZoneP2Enabled = false;
    public static boolean cardZoneP3Enabled = false;
    public static boolean cardZoneP4Enabled = false;
    
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu filemenu;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JButton p1BetButton;
    private javax.swing.JButton p1Chip10;
    private javax.swing.JButton p1Chip20;
    private javax.swing.JButton p1Chip5;
    private javax.swing.JButton p1Chip50;
    private javax.swing.JButton p2BetButton;
    private javax.swing.JButton p2Chip10;
    private javax.swing.JButton p2Chip20;
    private javax.swing.JButton p2Chip5;
    private javax.swing.JButton p2Chip50;
    private javax.swing.JButton p3BetButton;
    private javax.swing.JButton p3Chip10;
    private javax.swing.JButton p3Chip20;
    private javax.swing.JButton p3Chip5;
    private javax.swing.JButton p3Chip50;
    private javax.swing.JButton p4BetButton;
    private javax.swing.JButton p4Chip10;
    private javax.swing.JButton p4Chip20;
    private javax.swing.JButton p4Chip5;
    private javax.swing.JButton p4Chip50;
    
 // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel betZoneLabelP1;
    private javax.swing.JLabel betZoneLabelP2;
    private javax.swing.JLabel betZoneLabelP3;
    private javax.swing.JLabel betZoneLabelP4;
    private javax.swing.JPanel betZonePanelP1;
    private javax.swing.JPanel betZonePanelP2;
    private javax.swing.JPanel betZonePanelP3;
    private javax.swing.JPanel betZonePanelP4;
    
    private javax.swing.JButton buttonCard1P1;
    private javax.swing.JButton buttonCard1P2;
    private javax.swing.JButton buttonCard1P3;
    private javax.swing.JButton buttonCard1P4;
    private javax.swing.JButton buttonCard2P1;
    private javax.swing.JButton buttonCard2P2;
    private javax.swing.JButton buttonCard2P3;
    private javax.swing.JButton buttonCard2P4;
    
    private javax.swing.JButton buttonFlop1;
    private javax.swing.JButton buttonFlop2;
    private javax.swing.JButton buttonFlop3;
    
    private javax.swing.JButton buttonRiver;
    
    private javax.swing.JButton buttonTurn;
    
    private javax.swing.JPanel cardZoneP1;
    private javax.swing.JPanel cardZoneP2;
    private javax.swing.JPanel cardZoneP3;
    private javax.swing.JPanel cardZoneP4;
    
    private javax.swing.JPanel centralInternalPanel;
    
    private PokerFrameEventListener pListener;
    private PokerFrameChipListener cListener;

    /** Creates new form PokerFrame */
    public PokerFrame() {
        initComponents();
        
        cardZoneP1Enabled = false;
        cardZoneP2Enabled = false;
        cardZoneP3Enabled = false;
        cardZoneP4Enabled = false;
        
        cardZoneP1.setName("cardZoneP1");
        cardZoneP2.setName("cardZoneP2");
        cardZoneP3.setName("cardZoneP3");
        cardZoneP4.setName("cardZoneP4");
        //setResizable(false);
        setSize(mainPanel.getWidth()+50, mainPanel.getHeight()+200);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    	
    	addMouseListener( this );
		addMouseMotionListener( this );
		
    	pListener = new PokerFrameEventListener();
    	cListener = new PokerFrameChipListener();
    	
        mainPanel = new javax.swing.JPanel();
        p1BetButton = new javax.swing.JButton();
        p4BetButton = new javax.swing.JButton();
        p3BetButton = new javax.swing.JButton();
        p2BetButton = new javax.swing.JButton();
        player1InternalPanel = new javax.swing.JPanel();
        player1InternalPanel.setName("player1InternalPanel");
        player1InternalPanel.addMouseListener(pListener);// faut enlever chacun des adds ici
        
        p1Chip5 = new javax.swing.JButton();
        p1Chip5.setName("p1Chip5");
        p1Chip5.addMouseListener(cListener);
        p1Chip5.addMouseMotionListener(cListener);
        
        p1Chip10 = new javax.swing.JButton();
        p1Chip10.setName("p1Chip10");
        p1Chip10.addMouseListener(cListener);
        p1Chip10.addMouseMotionListener(cListener);
        
        p1Chip20 = new javax.swing.JButton();
        p1Chip20.setName("p1Chip20");
        p1Chip20.addMouseListener(cListener);
        p1Chip20.addMouseMotionListener(cListener);
        
        p1Chip50 = new javax.swing.JButton();
        p1Chip50.setName("p1Chip50");
        p1Chip50.addMouseListener(cListener);
        p1Chip50.addMouseMotionListener(cListener);
        
        betZonePanelP1 = new javax.swing.JPanel();
        betZonePanelP1.setName("betZonePanelP1");
        betZoneLabelP1 = new javax.swing.JLabel();
        
        cardZoneP1 = new javax.swing.JPanel();
        cardZoneP1.setName("cardZoneP1");
        cardZoneP1.addMouseListener(pListener);//MOUSE LISTENER
        
        buttonCard1P1 = new javax.swing.JButton();
        buttonCard1P1.setName("buttonCard1P1");
        buttonCard1P1.addMouseListener(pListener);
        buttonCard2P1 = new javax.swing.JButton();
        buttonCard2P1.setName("buttonCard2P1");
        buttonCard2P1.addMouseListener(pListener);
        
        player2InternalPanel = new javax.swing.JPanel();
        player2InternalPanel.setName("player2InternalPanel");
        player2InternalPanel.addMouseListener(pListener);
        
        p2Chip5 = new javax.swing.JButton();
        p2Chip5.setName("p2Chip5");
        p2Chip5.addMouseListener(cListener);
        p2Chip5.addMouseMotionListener(cListener);
        
        p2Chip10 = new javax.swing.JButton();
        p2Chip10.setName("p2Chip10");
        p2Chip10.addMouseListener(cListener);
        p2Chip10.addMouseMotionListener(cListener);
        
        p2Chip20 = new javax.swing.JButton();
        p2Chip20.setName("p2Chip20");
        p2Chip20.addMouseListener(cListener);
        p2Chip20.addMouseMotionListener(cListener);
        
        p2Chip50 = new javax.swing.JButton();
        p2Chip50.setName("p2Chip50");
        p2Chip50.addMouseListener(cListener);
        p2Chip50.addMouseMotionListener(cListener);
        
        betZonePanelP2 = new javax.swing.JPanel();
        betZonePanelP2.setName("betZonePanelP2");
        betZoneLabelP2 = new javax.swing.JLabel();
        
        cardZoneP2 = new javax.swing.JPanel();
        cardZoneP2.setName("cardZoneP2");
        cardZoneP2.addMouseListener(pListener);//MOUSE LISTENER
        
        buttonCard1P2 = new javax.swing.JButton();
        buttonCard1P2.setName("buttonCard1P2");
        buttonCard1P2.addMouseListener(pListener);
        buttonCard2P2 = new javax.swing.JButton();
        buttonCard2P2.setName("buttonCard2P2");
        buttonCard2P2.addMouseListener(pListener);
        
        player3InternalPanel = new javax.swing.JPanel();
        player3InternalPanel.setName("player3InternalPanel");
        player3InternalPanel.addMouseListener(pListener);
        
        p3Chip50 = new javax.swing.JButton();
        p3Chip50.setName("p3Chip50");
        p3Chip50.addMouseListener(cListener);
        p3Chip50.addMouseMotionListener(cListener);
        
        p3Chip20 = new javax.swing.JButton();
        p3Chip20.setName("p3Chip20");
        p3Chip20.addMouseListener(cListener);
        p3Chip20.addMouseMotionListener(cListener);
        
        p3Chip10 = new javax.swing.JButton();
        p3Chip10.setName("p3Chip10");
        p3Chip10.addMouseListener(cListener);
        p3Chip10.addMouseMotionListener(cListener);
        
        p3Chip5 = new javax.swing.JButton();
        p3Chip5.setName("p3Chip5");
        p3Chip5.addMouseListener(cListener);
        p3Chip5.addMouseMotionListener(cListener);
        
        betZonePanelP3 = new javax.swing.JPanel();
        betZonePanelP3.setName("betZonePanelP3");
        betZoneLabelP3 = new javax.swing.JLabel();
        
        cardZoneP3 = new javax.swing.JPanel();
        cardZoneP3.setName("cardZoneP3");
        cardZoneP3.addMouseListener(pListener);//MOUSE LISTENER
        
        buttonCard2P3 = new javax.swing.JButton();
        buttonCard2P3.setName("buttonCard2P3");
        buttonCard2P3.addMouseListener(pListener);
        buttonCard1P3 = new javax.swing.JButton();
        buttonCard1P3.setName("buttonCard1P3");
        buttonCard1P3.addMouseListener(pListener);
        
        centralInternalPanel = new javax.swing.JPanel();
        
        buttonFlop1 = new javax.swing.JButton();
        buttonFlop2 = new javax.swing.JButton();
        buttonFlop3 = new javax.swing.JButton();
        buttonTurn = new javax.swing.JButton();
        buttonRiver = new javax.swing.JButton();
        player4InternalPanel = new javax.swing.JPanel();
        player4InternalPanel.setName("player4InternalPanel");
        player4InternalPanel.addMouseListener(pListener);
        
        p4Chip50 = new javax.swing.JButton();
        p4Chip50.setName("p4Chip50");
        p4Chip50.addMouseListener(cListener);
        p4Chip50.addMouseMotionListener(cListener);
        
        p4Chip20 = new javax.swing.JButton();
        p4Chip20.setName("p4Chip20");
        p4Chip20.addMouseListener(cListener);
        p4Chip20.addMouseMotionListener(cListener);
        
        p4Chip10 = new javax.swing.JButton();
        p4Chip10.setName("p4Chip10");
        p4Chip10.addMouseListener(cListener);
        p4Chip10.addMouseMotionListener(cListener);
        
        p4Chip5 = new javax.swing.JButton();
        p4Chip5.setName("p4Chip5");
        p4Chip5.addMouseListener(cListener);
        p4Chip5.addMouseMotionListener(cListener);
        
        betZonePanelP4 = new javax.swing.JPanel();
        betZonePanelP4.setName("betZonePanelP4");
        betZoneLabelP4 = new javax.swing.JLabel();
        
        cardZoneP4 = new javax.swing.JPanel();
        cardZoneP4.setName("cardZoneP4");
        cardZoneP4.addMouseListener(pListener);//MOUSE LISTENER
        
        buttonCard1P4 = new javax.swing.JButton();
        buttonCard1P4.setName("buttonCard1P4");
        buttonCard1P4.addMouseListener(pListener);
        buttonCard2P4 = new javax.swing.JButton();
        buttonCard2P4.setName("buttonCard2P4");
        buttonCard2P4.addMouseListener(pListener);
        
        menuBar = new javax.swing.JMenuBar();
        filemenu = new javax.swing.JMenu();
        exitMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Multitouch Texas Hold'em");
        setName("pokerFrame"); // NOI18N

        mainPanel.setBackground(new java.awt.Color(0, 153, 51));
        
        p1BetButton.setText("Bet");

        p4BetButton.setText("Bet");

        p3BetButton.setText("Bet");

        p2BetButton.setText("Bet");

        player1InternalPanel.setOpaque(false);

        p1Chip5.setText("p1Chip5");

        p1Chip10.setText("p1Chip10");

        p1Chip20.setText("p1Chip20");

        p1Chip50.setText("p1Chip50");

        betZonePanelP1.setBackground(new java.awt.Color(255, 204, 204));
        betZonePanelP1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        betZoneLabelP1.setText("Bet zone player 1");

        javax.swing.GroupLayout betZonePanelP1Layout = new javax.swing.GroupLayout(betZonePanelP1);
        betZonePanelP1.setLayout(betZonePanelP1Layout);
        betZonePanelP1Layout.setHorizontalGroup(
            betZonePanelP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(betZonePanelP1Layout.createSequentialGroup()
                .addComponent(betZoneLabelP1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(293, Short.MAX_VALUE))
        );
        betZonePanelP1Layout.setVerticalGroup(
            betZonePanelP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(betZonePanelP1Layout.createSequentialGroup()
                .addComponent(betZoneLabelP1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(57, Short.MAX_VALUE))
        );

        buttonCard1P1.setText("card1P1");
        
        buttonCard2P1.setText("card2P1");

        javax.swing.GroupLayout cardZoneP1Layout = new javax.swing.GroupLayout(cardZoneP1);
        cardZoneP1.setLayout(cardZoneP1Layout);
        cardZoneP1Layout.setHorizontalGroup(
            cardZoneP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cardZoneP1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonCard1P1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonCard2P1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        cardZoneP1Layout.setVerticalGroup(
            cardZoneP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cardZoneP1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(cardZoneP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(buttonCard2P1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(buttonCard1P1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout player1InternalPanelLayout = new javax.swing.GroupLayout(player1InternalPanel);
        player1InternalPanel.setLayout(player1InternalPanelLayout);
        player1InternalPanelLayout.setHorizontalGroup(
            player1InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player1InternalPanelLayout.createSequentialGroup()
                .addComponent(p1Chip5, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addComponent(p1Chip10, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 169, Short.MAX_VALUE)
                .addComponent(p1Chip20, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(36, 36, 36)
                .addComponent(p1Chip50, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(betZonePanelP1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(player1InternalPanelLayout.createSequentialGroup()
                .addGap(131, 131, 131)
                .addComponent(cardZoneP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(133, Short.MAX_VALUE))
        );
        player1InternalPanelLayout.setVerticalGroup(
            player1InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player1InternalPanelLayout.createSequentialGroup()
                .addComponent(betZonePanelP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(player1InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(p1Chip5)
                    .addComponent(p1Chip10)
                    .addComponent(p1Chip50)
                    .addComponent(p1Chip20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cardZoneP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        player2InternalPanel.setOpaque(false);
        player2InternalPanel.setPreferredSize(new java.awt.Dimension(135, 326));

        p2Chip5.setText("p2Chip5");

        p2Chip10.setText("p2Chip10");

        p2Chip20.setText("p2Chip20");

        p2Chip50.setText("p2Chip50");

        betZonePanelP2.setBackground(new java.awt.Color(255, 204, 204));
        betZonePanelP2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        betZoneLabelP2.setText("Bet zone player 2");

        javax.swing.GroupLayout betZonePanelP2Layout = new javax.swing.GroupLayout(betZonePanelP2);
        betZonePanelP2.setLayout(betZonePanelP2Layout);
        betZonePanelP2Layout.setHorizontalGroup(
            betZonePanelP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(betZoneLabelP2, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
        );
        betZonePanelP2Layout.setVerticalGroup(
            betZonePanelP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(betZonePanelP2Layout.createSequentialGroup()
                .addComponent(betZoneLabelP2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(287, Short.MAX_VALUE))
        );

        buttonCard1P2.setText("card1P2");

        buttonCard2P2.setText("card2P2");

        javax.swing.GroupLayout cardZoneP2Layout = new javax.swing.GroupLayout(cardZoneP2);
        cardZoneP2.setLayout(cardZoneP2Layout);
        cardZoneP2Layout.setHorizontalGroup(
            cardZoneP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cardZoneP2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(cardZoneP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonCard1P2)
                    .addComponent(buttonCard2P2))
                .addContainerGap(15, Short.MAX_VALUE))
        );
        cardZoneP2Layout.setVerticalGroup(
            cardZoneP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cardZoneP2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonCard1P2, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonCard2P2, javax.swing.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)
                .addGap(12, 12, 12))
        );

        javax.swing.GroupLayout player2InternalPanelLayout = new javax.swing.GroupLayout(player2InternalPanel);
        player2InternalPanel.setLayout(player2InternalPanelLayout);
        player2InternalPanelLayout.setHorizontalGroup(
            player2InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player2InternalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cardZoneP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(player2InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p2Chip5, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(player2InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(p2Chip50, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                        .addComponent(p2Chip10, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                        .addComponent(p2Chip20, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 42, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(betZonePanelP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        player2InternalPanelLayout.setVerticalGroup(
            player2InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(betZonePanelP2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(player2InternalPanelLayout.createSequentialGroup()
                .addGap(71, 71, 71)
                .addComponent(p2Chip5)
                .addGap(37, 37, 37)
                .addComponent(p2Chip10)
                .addGap(34, 34, 34)
                .addComponent(p2Chip20)
                .addGap(40, 40, 40)
                .addComponent(p2Chip50)
                .addContainerGap(52, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, player2InternalPanelLayout.createSequentialGroup()
                .addContainerGap(104, Short.MAX_VALUE)
                .addComponent(cardZoneP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(74, 74, 74))
        );

        player3InternalPanel.setOpaque(false);

        p3Chip50.setText("p3Chip50");

        p3Chip20.setText("p3Chip20");

        p3Chip10.setText("p3Chip10");

        p3Chip5.setText("p3Chip5");

        betZonePanelP3.setBackground(new java.awt.Color(255, 204, 204));

        betZoneLabelP3.setText("Bet zone player 3");

        javax.swing.GroupLayout betZonePanelP3Layout = new javax.swing.GroupLayout(betZonePanelP3);
        betZonePanelP3.setLayout(betZonePanelP3Layout);
        betZonePanelP3Layout.setHorizontalGroup(
            betZonePanelP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(betZonePanelP3Layout.createSequentialGroup()
                .addComponent(betZoneLabelP3, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(323, Short.MAX_VALUE))
        );
        betZonePanelP3Layout.setVerticalGroup(
            betZonePanelP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, betZonePanelP3Layout.createSequentialGroup()
                .addContainerGap(64, Short.MAX_VALUE)
                .addComponent(betZoneLabelP3, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        buttonCard2P3.setText("card2P3");

        buttonCard1P3.setText("card1P3");

        javax.swing.GroupLayout cardZoneP3Layout = new javax.swing.GroupLayout(cardZoneP3);
        cardZoneP3.setLayout(cardZoneP3Layout);
        cardZoneP3Layout.setHorizontalGroup(
            cardZoneP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cardZoneP3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonCard2P3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(buttonCard1P3)
                .addContainerGap())
        );
        cardZoneP3Layout.setVerticalGroup(
            cardZoneP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cardZoneP3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(cardZoneP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(buttonCard1P3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
                    .addComponent(buttonCard2P3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout player3InternalPanelLayout = new javax.swing.GroupLayout(player3InternalPanel);
        player3InternalPanel.setLayout(player3InternalPanelLayout);
        player3InternalPanelLayout.setHorizontalGroup(
            player3InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player3InternalPanelLayout.createSequentialGroup()
                .addComponent(p3Chip50, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(p3Chip20, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 177, Short.MAX_VALUE)
                .addComponent(p3Chip10, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(p3Chip5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(betZonePanelP3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(player3InternalPanelLayout.createSequentialGroup()
                .addGap(134, 134, 134)
                .addComponent(cardZoneP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(130, Short.MAX_VALUE))
        );
        player3InternalPanelLayout.setVerticalGroup(
            player3InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player3InternalPanelLayout.createSequentialGroup()
                .addComponent(cardZoneP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(player3InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(p3Chip50)
                    .addComponent(p3Chip20)
                    .addComponent(p3Chip5)
                    .addComponent(p3Chip10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                .addComponent(betZonePanelP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        centralInternalPanel.setBackground(new java.awt.Color(153, 204, 255));
        centralInternalPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        buttonFlop1.setText("flop1");

        buttonFlop2.setText("flop2");

        buttonFlop3.setText("flop3");

        buttonTurn.setText("turn");

        buttonRiver.setText("river");

        javax.swing.GroupLayout centralInternalPanelLayout = new javax.swing.GroupLayout(centralInternalPanel);
        centralInternalPanel.setLayout(centralInternalPanelLayout);
        centralInternalPanelLayout.setHorizontalGroup(
            centralInternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(centralInternalPanelLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(buttonFlop1, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(buttonFlop2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(buttonFlop3, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                .addComponent(buttonTurn, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(buttonRiver, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        centralInternalPanelLayout.setVerticalGroup(
            centralInternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, centralInternalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(centralInternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonFlop1, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                    .addComponent(buttonRiver, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                    .addComponent(buttonFlop2, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                    .addComponent(buttonFlop3, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                    .addComponent(buttonTurn, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE))
                .addContainerGap())
        );

        player4InternalPanel.setOpaque(false);

        p4Chip50.setText("p4Chip50");

        p4Chip20.setText("p4Chip20");

        p4Chip10.setText("p4Chip10");

        p4Chip5.setText("p4Chip5");

        betZonePanelP4.setBackground(new java.awt.Color(255, 204, 204));

        betZoneLabelP4.setText("Bet zone player 4");

        javax.swing.GroupLayout betZonePanelP4Layout = new javax.swing.GroupLayout(betZonePanelP4);
        betZonePanelP4.setLayout(betZonePanelP4Layout);
        betZonePanelP4Layout.setHorizontalGroup(
            betZonePanelP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(betZoneLabelP4, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
        );
        betZonePanelP4Layout.setVerticalGroup(
            betZonePanelP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(betZonePanelP4Layout.createSequentialGroup()
                .addComponent(betZoneLabelP4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(293, Short.MAX_VALUE))
        );

        buttonCard1P4.setText("card1P4");

        buttonCard2P4.setText("card2P4");

        javax.swing.GroupLayout cardZoneP4Layout = new javax.swing.GroupLayout(cardZoneP4);
        cardZoneP4.setLayout(cardZoneP4Layout);
        cardZoneP4Layout.setHorizontalGroup(
            cardZoneP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cardZoneP4Layout.createSequentialGroup()
                .addContainerGap(15, Short.MAX_VALUE)
                .addGroup(cardZoneP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(buttonCard2P4)
                    .addComponent(buttonCard1P4))
                .addContainerGap())
        );
        cardZoneP4Layout.setVerticalGroup(
            cardZoneP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cardZoneP4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonCard1P4, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonCard2P4, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout player4InternalPanelLayout = new javax.swing.GroupLayout(player4InternalPanel);
        player4InternalPanel.setLayout(player4InternalPanelLayout);
        player4InternalPanelLayout.setHorizontalGroup(
            player4InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, player4InternalPanelLayout.createSequentialGroup()
            	.addGap(128, 128, 128)
                .addGroup(player4InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p4Chip5, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(player4InternalPanelLayout.createSequentialGroup()
                        .addGroup(player4InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(p4Chip20, 0, 0, Short.MAX_VALUE)
                            .addGroup(player4InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(p4Chip10, 0, 0, Short.MAX_VALUE)
                                .addComponent(p4Chip50, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 43, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cardZoneP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(5, 5, 5))))
                .addComponent(betZonePanelP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
               
                
        );
        player4InternalPanelLayout.setVerticalGroup(
            player4InternalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(betZonePanelP4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(player4InternalPanelLayout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addComponent(p4Chip50)
                .addGap(43, 43, 43)
                .addComponent(p4Chip20)
                .addGap(58, 58, 58)
                .addComponent(p4Chip10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
                .addComponent(p4Chip5)
                .addGap(42, 42, 42))
            .addGroup(player4InternalPanelLayout.createSequentialGroup()
                .addGap(91, 91, 91)
                .addComponent(cardZoneP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(84, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p2BetButton)
                    .addComponent(p3BetButton)
                    .addComponent(player2InternalPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(player1InternalPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(centralInternalPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(player3InternalPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(262, 262, 262)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(p1BetButton)
                            .addComponent(p4BetButton)))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(player4InternalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(p4BetButton)
                            .addComponent(p3BetButton))
                        .addGap(119, 119, 119)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(player2InternalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(player4InternalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 129, Short.MAX_VALUE)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(p1BetButton, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(p2BetButton, javax.swing.GroupLayout.Alignment.TRAILING)))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(player3InternalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(centralInternalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(player1InternalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        filemenu.setText("File");

        exitMenuItem.setToolTipText("Exit the game.");
        exitMenuItem.setText("Exit");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        filemenu.add(exitMenuItem);

        menuBar.add(filemenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 1046, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE)
                .addContainerGap())
        );
        
        //mainPanel.setSize(new java.awt.Dimension(player2InternalPanel.getWidth() + player4InternalPanel.getWidth() + player3InternalPanel.getWidth(),
        		//player2InternalPanel.getHeight() + player1InternalPanel.getHeight() + player3InternalPanel.getHeight()));
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PokerFrame().setVisible(true);
            }
        });
    }
  
    
    public boolean isCardZoneP1Enabled() {
		return cardZoneP1Enabled;
	}
  
    
    /*GETTERS AND SETTERS*/
	public void setCardZoneP1Enabled(boolean cardZoneP1Enabled) {
		this.cardZoneP1Enabled = cardZoneP1Enabled;
	}

	public javax.swing.JPanel getBetZonePanelP1() {
		return betZonePanelP1;
	}

	public javax.swing.JPanel getBetZonePanelP2() {
		return betZonePanelP2;
	}

	public javax.swing.JPanel getBetZonePanelP3() {
		return betZonePanelP3;
	}

	public javax.swing.JPanel getBetZonePanelP4() {
		return betZonePanelP4;
	}

	public boolean isCardZoneP2Enabled() {
		return cardZoneP2Enabled;
	}

	public void setCardZoneP2Enabled(boolean cardZoneP2Enabled) {
		this.cardZoneP2Enabled = cardZoneP2Enabled;
	}

	public boolean isCardZoneP3Enabled() {
		return cardZoneP3Enabled;
	}

	public void setCardZoneP3Enabled(boolean cardZoneP3Enabled) {
		this.cardZoneP3Enabled = cardZoneP3Enabled;
	}

	public boolean isCardZoneP4Enabled() {
		return cardZoneP4Enabled;
	}

	public void setCardZoneP4Enabled(boolean cardZoneP4Enabled) {
		this.cardZoneP4Enabled = cardZoneP4Enabled;
	}
        
    public javax.swing.JPanel getCardZoneP1() {
		return cardZoneP1;
	}

	public void setCardZoneP1(javax.swing.JPanel cardZoneP1) {
		this.cardZoneP1 = cardZoneP1;
	}

	public javax.swing.JPanel getCardZoneP2() {
		return cardZoneP2;
	}

	public void setCardZoneP2(javax.swing.JPanel cardZoneP2) {
		this.cardZoneP2 = cardZoneP2;
	}

	public javax.swing.JPanel getCardZoneP3() {
		return cardZoneP3;
	}

	public void setCardZoneP3(javax.swing.JPanel cardZoneP3) {
		this.cardZoneP3 = cardZoneP3;
	}

	public javax.swing.JButton getButtonFlop1() {
		return buttonFlop1;
	}

	public void setButtonFlop1(javax.swing.JButton buttonFlop1) {
		this.buttonFlop1 = buttonFlop1;
	}

	public javax.swing.JButton getButtonFlop2() {
		return buttonFlop2;
	}

	public void setButtonFlop2(javax.swing.JButton buttonFlop2) {
		this.buttonFlop2 = buttonFlop2;
	}

	public javax.swing.JButton getButtonFlop3() {
		return buttonFlop3;
	}

	public void setButtonFlop3(javax.swing.JButton buttonFlop3) {
		this.buttonFlop3 = buttonFlop3;
	}

	public javax.swing.JButton getButtonRiver() {
		return buttonRiver;
	}

	public void setButtonRiver(javax.swing.JButton buttonRiver) {
		this.buttonRiver = buttonRiver;
	}

	public javax.swing.JButton getButtonTurn() {
		return buttonTurn;
	}

	public void setButtonTurn(javax.swing.JButton buttonTurn) {
		this.buttonTurn = buttonTurn;
	}

	public javax.swing.JPanel getCardZoneP4() {
		return cardZoneP4;
	}

	public void setCardZoneP4(javax.swing.JPanel cardZoneP4) {
		this.cardZoneP4 = cardZoneP4;
	}
	      
    public JButton[] getChips(JPanel internal){
    	if(internal.equals(player1InternalPanel)){
    		return new JButton[]{p1Chip5,p1Chip10,p1Chip20,p1Chip50};
    	}
    	else if(internal.equals(player2InternalPanel)){
    		return new JButton[]{p2Chip5,p2Chip10,p2Chip20,p2Chip50};
    	}
    	else if(internal.equals(player3InternalPanel)){
    		return new JButton[]{p3Chip5,p3Chip10,p3Chip20,p3Chip50};
    	}
    	else if(internal.equals(player4InternalPanel)){
    		return new JButton[]{p4Chip5,p4Chip10,p4Chip20,p4Chip50};
    	}
    	else{
    		return null;
    	}
    }
    
    public int getChipsTotal(JPanel betZonePanel){
    	int total = 0;
    	for(int i = 0; i < betZonePanel.getComponentCount(); i++){
    		if(betZonePanel.getComponent(i).equals(p1Chip5)
    				|| betZonePanel.getComponent(i).equals(p2Chip5)
    				|| betZonePanel.getComponent(i).equals(p3Chip5)
    				|| betZonePanel.getComponent(i).equals(p4Chip5)){
    			total += 5;
    		}
    		else if(betZonePanel.getComponent(i).equals(p1Chip10)
    				|| betZonePanel.getComponent(i).equals(p2Chip10)
    				|| betZonePanel.getComponent(i).equals(p3Chip10)
    				|| betZonePanel.getComponent(i).equals(p4Chip10)){
    			total += 10;
    		}
    		else if(betZonePanel.getComponent(i).equals(p1Chip20)
    				|| betZonePanel.getComponent(i).equals(p2Chip20)
    				|| betZonePanel.getComponent(i).equals(p3Chip20)
    				|| betZonePanel.getComponent(i).equals(p4Chip20)){
    			total += 20;
    		}
    		else if(betZonePanel.getComponent(i).equals(p1Chip50)
    				|| betZonePanel.getComponent(i).equals(p2Chip50)
    				|| betZonePanel.getComponent(i).equals(p3Chip50)
    				|| betZonePanel.getComponent(i).equals(p4Chip50)){
    			total += 50;
    		}
    	}
    	return total;
    }
    
    public JButton[] getButtonCards(JPanel internal){
    	if(internal.equals(player1InternalPanel)){
    		return new JButton[]{buttonCard1P1,buttonCard2P1};
    	}
    	else if(internal.equals(player2InternalPanel)){
    		return new JButton[]{buttonCard1P2,buttonCard2P2};
    	}
    	else if(internal.equals(player3InternalPanel)){
    		return new JButton[]{buttonCard1P3,buttonCard2P3};
    	}
    	else if(internal.equals(player4InternalPanel)){
    		return new JButton[]{buttonCard1P4,buttonCard2P4};
    	}
    	else{
    		return null;
    	}
    }
    
	public javax.swing.JPanel getPlayer1InternalPanel() {
		return player1InternalPanel;
	}

	public PokerFrameEventListener getPListener() {
		return pListener;
	}

	public PokerFrameChipListener getCListener() {
		return cListener;
	}

	public void setCListener(PokerFrameChipListener listener) {
		cListener = listener;
	}

	public void setPListener(PokerFrameEventListener listener) {
		pListener = listener;
	}

	public javax.swing.JPanel getCentralInternalPanel() {
		return centralInternalPanel;
	}

	public void setCentralInternalPanel(javax.swing.JPanel centralInternalPanel) {
		this.centralInternalPanel = centralInternalPanel;
	}

	public void setPlayer1InternalPanel(javax.swing.JPanel player1InternalPanel) {
		this.player1InternalPanel = player1InternalPanel;
	}

	public javax.swing.JPanel getPlayer2InternalPanel() {
		return player2InternalPanel;
	}

	public void setPlayer2InternalPanel(javax.swing.JPanel player2InternalPanel) {
		this.player2InternalPanel = player2InternalPanel;
	}

	public javax.swing.JPanel getPlayer3InternalPanel() {
		return player3InternalPanel;
	}

	public void setPlayer3InternalPanel(javax.swing.JPanel player3InternalPanel) {
		this.player3InternalPanel = player3InternalPanel;
	}

	public javax.swing.JPanel getPlayer4InternalPanel() {
		return player4InternalPanel;
	}

	public void setPlayer4InternalPanel(javax.swing.JPanel player4InternalPanel) {
		this.player4InternalPanel = player4InternalPanel;
	}

	
	/*ACTIONS*/
	
	public void mouseEntered( MouseEvent e ) {
		//client.mouseEntered(e);
		//pf.getCListener().mouseEntered(e);
	}
	public void mouseExited( MouseEvent e ) {
		//client.mouseExited(e);
		//pf.getCListener().mouseExited(e);
	}
	public void mouseClicked( MouseEvent e ) {
		//client.mouseClicked(e);
		//pf.getCListener().mouseClicked(e);
	}
	
	public void mousePressed( MouseEvent e ) {
		System.out.println(mainPanel.findComponentAt(e.getX(), e.getY()));
		mouse_x = e.getX();
		mouse_y = e.getY();
		if ( e.isControlDown() ) {
			if ( indexOfFingerUnderMouse == -1 ) {
				indexOfFingerUnderMouse = fingerContainer.createFinger( e.getX(), e.getY() );
				Finger f = fingerContainer.getFingerByIndex( indexOfFingerUnderMouse );
				getCListener().processMultitouchInputEvent(
					f.id,
					f.position.x(),
					f.position.y(),
					TOUCH_EVENT_DOWN,
					e
				);
			}
			isFingerDraggingModeActive = true;
		}
		System.out.println("mouse pressed");
		requestRedraw();
	}
	public void mouseReleased( MouseEvent e ) {
//		mouse_x = e.getX();
//		mouse_y = e.getY();
//		if ( isFingerDraggingModeActive ) {
//			if ( SwingUtilities.isRightMouseButton(e) ) {
//				Finger f = fingerContainer.getFingerByIndex( indexOfFingerUnderMouse );
//				pf.getCListener().processMultitouchInputEvent(
//					f.id,
//					f.position.x(),
//					f.position.y(),
//					TOUCH_EVENT_UP,
//					e
//				);
//				fingerContainer.deleteFingerByIndex( indexOfFingerUnderMouse );
//			}
//			isFingerDraggingModeActive = false;
//			indexOfFingerUnderMouse = -1;
//			updateHiliting( e.getX(), e.getY() );
//			
//		}
		System.out.println("mouse release");
		requestRedraw();
	}
	public void mouseMoved( MouseEvent e ) {
//		mouse_x = e.getX();
//		mouse_y = e.getY();
//		//client.mouseMoved( e );
//		//pf.getCListener().mouseMoved(e);
		//System.out.println("mouse move");
		requestRedraw();
		//updateHiliting( e.getX(), e.getY() );
	}
	public void mouseDragged( MouseEvent e ) {
		
		if ( indexOfFingerUnderMouse == -1 ) {
			indexOfFingerUnderMouse = fingerContainer.createFinger( e.getX(), e.getY() );
			Finger f = fingerContainer.getFingerByIndex( indexOfFingerUnderMouse );
			f.position.get()[0] += e.getX() - mouse_x;
			f.position.get()[1] += e.getY() - mouse_y;
			getCListener().processMultitouchInputEvent(
				f.id,
				f.position.x(),
				f.position.y(),
				TOUCH_EVENT_DOWN,
				e
			);
		}
		
		
		getCListener().mouseDragged(e);
		mouse_x = e.getX();
		mouse_y = e.getY();
		requestRedraw();
	}

	public void requestRedraw() {
		repaint();
	}
}
